$(function () {
    var ue;

    function ReportDetail() {
        // 表格ID
        this.$feedback = $("#feedback");
        // 按钮
        this.$submit_btn = $('#submit_btn');
        this.$process_btn = $('#process_btn');
        this.caseId = $('#case_id').val();
        this.$process_modal = $('#process_modal');
        // 初始化
        this.init();
    }

    ReportDetail.prototype.Constructor = ReportDetail;

    ReportDetail.prototype.init = function () {
        this.registEvent();
    };

    ReportDetail.prototype.registEvent = function () {
        var that = this;
        this.$process_btn.click(function () {
            that.$process_modal.modal('show');
        });

        this.$submit_btn.click(function () {
            var feedback = $.trim(that.$feedback.val());
            if (!feedback)
                feedback = '已经成功处理';
            if (feedback.length > 50) {
                that.$feedback.focus();
                BootBox.warning('反馈信息最多为50个字符！');
                return false;
            }
            SysTool.Ajax.ajaxJsonCall('pm/report/process/' + that.caseId, {feedback: feedback}, function (data) {
                that.$process_modal.modal('hide');
                that.$feedback.val('');
                BootBox.success('提交成功！', function () {
                    window.location.href = '/pm/report/';
                });
            });
        });
    };

    window.ReportDetail = new ReportDetail();
});